home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / number / numbers.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  4.3 KB  |  151 lines

  1. VERSION 2.00
  2. Begin Form BCDDemo 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   2655
  5.    ClientLeft      =   2865
  6.    ClientTop       =   2760
  7.    ClientWidth     =   3360
  8.    Height          =   3060
  9.    Left            =   2805
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   2655
  13.    ScaleWidth      =   3360
  14.    Top             =   2415
  15.    Width           =   3480
  16.    Begin CommandButton MKDCVD 
  17.       Caption         =   "MK&D"
  18.       Height          =   372
  19.       Left            =   2280
  20.       TabIndex        =   4
  21.       Top             =   1200
  22.       Width           =   852
  23.    End
  24.    Begin TextBox MKDNumber 
  25.       Height          =   372
  26.       Left            =   240
  27.       TabIndex        =   8
  28.       Text            =   "1234.03566"
  29.       Top             =   1200
  30.       Width           =   1812
  31.    End
  32.    Begin CommandButton MKSCVS 
  33.       Caption         =   "MK&S"
  34.       Height          =   372
  35.       Left            =   2280
  36.       TabIndex        =   3
  37.       Top             =   840
  38.       Width           =   852
  39.    End
  40.    Begin TextBox MKSNumber 
  41.       Height          =   372
  42.       Left            =   240
  43.       TabIndex        =   7
  44.       Text            =   "12.23"
  45.       Top             =   840
  46.       Width           =   1812
  47.    End
  48.    Begin CommandButton MKLCVL 
  49.       Caption         =   "MK&L"
  50.       Height          =   372
  51.       Left            =   2280
  52.       TabIndex        =   0
  53.       Top             =   480
  54.       Width           =   852
  55.    End
  56.    Begin TextBox MKLNumber 
  57.       Height          =   372
  58.       Left            =   240
  59.       TabIndex        =   6
  60.       Text            =   "23432455"
  61.       Top             =   480
  62.       Width           =   1812
  63.    End
  64.    Begin CommandButton MKICVI 
  65.       Caption         =   "MK&I"
  66.       Height          =   372
  67.       Left            =   2280
  68.       TabIndex        =   2
  69.       Top             =   120
  70.       Width           =   852
  71.    End
  72.    Begin TextBox MKINumber 
  73.       Height          =   372
  74.       Left            =   240
  75.       TabIndex        =   1
  76.       Text            =   "25186"
  77.       Top             =   120
  78.       Width           =   1812
  79.    End
  80.    Begin Label memo 
  81.       Height          =   972
  82.       Left            =   120
  83.       TabIndex        =   5
  84.       Top             =   1680
  85.       Width           =   3252
  86.    End
  87. 'These routines replace Visual Basic's "missing"
  88. 'binary coded decimal and IEEE string/numeric
  89. 'conversion routines found in QuickBASIC 4.X
  90. 'as well as the BASIC PDS.
  91. 'Marquis Computing
  92. DefInt A-Z
  93. Sub Form_Load ()
  94.     StringToNumber
  95. End Sub
  96. Static Sub MKDCVD_Click ()
  97.     DoingMKD = DoingMKD = 0
  98.     If DoingMKD Then
  99.         Number# = Val(MKDNumber.text)
  100.         MKDNumber.text = MKD$(Number#)
  101.         MKDCVD.caption = "CV&D"
  102.     Else
  103.         bcd$ = MKDNumber.text
  104.         Number# = CVD(bcd$)
  105.         MKDNumber.text = LTrim$(Str$(Number#))
  106.         MKDCVD.caption = "MK&D"
  107.     End If
  108. End Sub
  109. Static Sub MKICVI_Click ()
  110.     DoingMKI = DoingMKI = 0
  111.     If DoingMKI Then
  112.         Number% = Val(MKINumber.text)
  113.         MKINumber.text = MKI$(Number%)
  114.         MKICVI.caption = "CV&I"
  115.     Else
  116.         bcd$ = MKINumber.text
  117.         Number% = CVI(bcd$)
  118.         MKINumber.text = LTrim$(Str$(Number%))
  119.         MKICVI.caption = "MK&I"
  120.     End If
  121. End Sub
  122. Static Sub MKLCVL_Click ()
  123.     DoingMKL = DoingMKL = 0
  124.     If DoingMKL Then
  125.         Number& = Val(MKLNumber.text)
  126.         MKLNumber.text = MKL$(Number&)
  127.         MKLCVL.caption = "CV&L"
  128.     Else
  129.         bcd$ = MKLNumber.text
  130.         Number& = CVL(bcd$)
  131.         MKLNumber.text = LTrim$(Str$(Number&))
  132.         MKLCVL.caption = "MK&L"
  133.     End If
  134. End Sub
  135. Static Sub MKSCVS_Click ()
  136.     DoingMKS = DoingMKS = 0
  137.     If DoingMKS Then
  138.         Number! = Val(MKSNumber.text)
  139.         MKSNumber.text = MKS$(Number!)
  140.         MKSCVS.caption = "CV&S"
  141.     Else
  142.         bcd$ = MKSNumber.text
  143.         Number! = CVS(bcd$)
  144.         MKSNumber.text = LTrim$(Str$(Number!))
  145.         MKSCVS.caption = "MK&S"
  146.     End If
  147. End Sub
  148. Sub StringToNumber ()
  149.     memo.caption = "Click button to convert to/from Binary Coded Decimal. Due to VB limitation, some characters won't print."
  150. End Sub
  151.